<template>
	<div>
		<v-header :headerLeftText="leftText" :headerCenterText="headerText"></v-header>

		<div class="container">
			<div class="padding_tb40 text_center">
				<img class="border_radius100" src="../static/images/logo.jpg" alt="logo" />
			</div>
			<div class="pad_lr20_tb10 f_size26">
				<input v-model="phone" class="account_input" type="" name="" id="" placeholder="请输入手机号或帐号" />
			</div>
			<div class="pad_lr20_tb10 f_size26">
				<input v-model="password" class="password_input" type="" name="" id="" placeholder="请输入登录密码" />
			</div>
			<div class="pad_lr20_tb10 pad_t110">
				<button @click="loginClick" class="login_btn bgd_color_main f_color_white f_size26">登录</button>
			</div>
			<div class="overflow_hide pad_lr40_tb10 f_size22">
				<router-link to="/retrievePassword">
					<div class="left">
						忘记密码
					</div>
				</router-link>
				<router-link to="/register">
					<div class="right">
						前去注册
					</div>
				</router-link>
			</div>
		</div>
	</div>
</template>
<script>
	export default {
		data() {
			return {
				leftText: '',
				headerText: '登录',
				phone: '',
				password: ''
			}
		},
		methods: {
			loginClick: function() {
				this.$api.post('/front/base/login', {
					phone: this.phone,
					password: this.password
				}, r => {
					console.log('r', r)
					if(r.code === 400) {
						Toast(r.error)
					} else {
						this.$router.push('/')
					}
				})
			},
			goIndex: function() {
				this.$router.push({
					path: '/'
				})
			}
		}
	}
</script>